package org.example.cake.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.example.cake.mapper.OrderpayinfoMapper;
import org.example.cake.entity.Orderpayinfo;
import org.example.cake.service.OrderpayinfoService;

import java.util.List;

@Service
public class OrderpayinfoServiceImpl implements OrderpayinfoService{

    @Resource
    private OrderpayinfoMapper orderpayinfoMapper;

    @Override
    public int deleteByPrimaryKey(Integer payid) {
        return orderpayinfoMapper.deleteByPrimaryKey(payid);
    }

    @Override
    public int insert(Orderpayinfo record) {
        return orderpayinfoMapper.insert(record);
    }

    @Override
    public int insertSelective(Orderpayinfo record) {
        return orderpayinfoMapper.insertSelective(record);
    }

    @Override
    public Orderpayinfo selectByPrimaryKey(Integer payid) {
        return orderpayinfoMapper.selectByPrimaryKey(payid);
    }

    @Override
    public int updateByPrimaryKeySelective(Orderpayinfo record) {
        return orderpayinfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Orderpayinfo record) {
        return orderpayinfoMapper.updateByPrimaryKey(record);
    }


    /**
     * 添加支付信息和订单信息以及减少优惠券
     * @param orderpayinfo 订单信息 （缺少蛋糕id以及订单id）
     * @return
     */
    @Override
    public Integer saveOrderpayinfo(Orderpayinfo orderpayinfo) {
        return orderpayinfoMapper.saveOrderpayinfo(orderpayinfo);
    }
    /**
     * 根据时间查询payid
     * @Date 2025-08-04 谭丽娜
     * @param date
     * @return
     */
    @Override
    public Integer getorderinfo(String date) {
        return orderpayinfoMapper.getorderinfo(date);
    }

    @Override
    public List<Orderpayinfo> selectOrderpayinfo(String ordernum, String address, String cakeName) {
        return orderpayinfoMapper.selectOrderpayinfo(ordernum,address,cakeName);
    }

    @Override
    public int updateRemark(int payid, String remark) {
        return orderpayinfoMapper.updateRemark(payid,remark);
    }

}
